﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SalePromotion.Service;

namespace SalePromotion.Extensions
{
    public static class SalePromotionExtensions
    {
        public static string GetStatus(this DateTime startDate, DateTime endDate)
        {

            if ((startDate) > DateTime.Now)
            {
                return "Scheduled";
            }
            if ((endDate) < DateTime.Now)
            {
                return "Inactive";
            }
            return "Active";

        }

        public static bool IsTokenFetched(this string ebayUserName)
        {
             var service = new SaleDiscountService();
             var token = service.GetEbayUserToken(ebayUserName);
            return (token != null && !string.IsNullOrEmpty(token.Token));

        }

    }
}